<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script type="text/javascript">
			function fun1()
			{
				var reg = /^[A-z]\w{2,14}$/
				var t1 = document.getElementById("t1").value
				if(reg.test(t1))
				{
					document.getElementById("s1").innerHTML = "OK"
				}
				else
				{
					document.getElementById("s1").innerHTML = "ERROR"
				}
				
			}
			function fun2()
			{
				var reg = /^1[0-9]{10}$/
				var t2 = document.getElementById("t2").value
				if(reg.test(t2))
				{
					document.getElementById("s2").innerHTML = "OK"
				}
				else
				{
					document.getElementById("s2").innerHTML = "ERROR"
				}
				
			}
			function fun3()
			{
				var reg = /(^0\d{3}-?\d{7}$)|(^0\d{2}-?\d{8}$)/
				var t3 = document.getElementById("t3").value
				if(reg.test(t3))
				{
					document.getElementById("s3").innerHTML = "OK"
				}
				else
				{
					document.getElementById("s3").innerHTML = "ERROR"
				}
				
			}
			function fun4()
			{
				var reg = /^(0|([1-9]\d{0,14}))(\.\d{1,2})?$/
				var t4 = document.getElementById("t4").value
				if(reg.test(t4))
				{
					document.getElementById("s4").innerHTML = "OK"
				}
				else
				{
					document.getElementById("s4").innerHTML = "ERROR"
				}
				
			}
		</script>
	</head>
	<body>
		请输入用户昵称：
		<input type="text" id="t1" />
		<button type="button" onclick="fun1()">检测</button>
		<span id="s1"></span>
		<br>
		请输入手机号码：
		<input type="text" id="t2" />
		<button type="button" onclick="fun2()">检测</button>
		<span id="s2"></span>
		<br>
		请输入座机号码：
		<input type="text" id="t3" />
		<button type="button" onclick="fun3()">检测</button>
		<span id="s3"></span>
		<br>
		请输入存款金额：
		<input type="text" id="t4" />
		<button type="button" onclick="fun4()">检测</button>
		<span id="s4"></span>
		<br>
	</body>
</html>
